package com.util.xls;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @auther carter
 * create time    2018-05-24
 * 方便打印出耗时，还有操作的线程；
 */
public final class LogPrintUtils {

    private static final Logger logger = LoggerFactory.getLogger(LogPrintUtils.class);

    public static void printTimeCost(long start, String opTitle) {
        printTimeCost(start,"",opTitle);
    }

    public static void printTimeCost(long start, String title,String opTitle) {
        logger.info("【{}】|方法签名:{}|耗时:【{}】毫秒|操作线程:【{}】", title,opTitle, (System.nanoTime() - start)/1000000, Thread.currentThread().getName());
    }

    /**
     * 打印出耗时时间
     * @param start   开始时间 System.Nano();
     * @param title   标题
     * @param methodSign  方法签名
     * @param param       方法参数
     */
    public static void printTimeCost(long start, String title,String methodSign, String param,String exceptionMessage) {
        logger.info("{} {} {} 【{}】 【{}】", title,methodSign, (System.nanoTime() - start)/1000000,param, exceptionMessage);
    }


}
